
#include <BCursor>
#include "member_BCursor.h"

using namespace BWE;

#define member					(*(member_BCursor*)_ptr)
#define member_allocate()		_ptr = new member_BCursor
#define member_release()		delete (member_BCursor*)_ptr

#ifdef _LINUX_
#include <unistd.h>

BCursor::BCursor(CursorType type)
{
	member_allocate();
	member.type = type;
}
BCursor::~BCursor()
{
	member_release();
}

void BCursor::setType(CursorType type)
{
	member.type = type;
}
CursorType BCursor::type() const
{
	return member.type;
}

void BCursor::setImage(BImage* image)
{
	member.image = image;
}
BImage* BCursor::image()
{
	return member.image.ptr();
}
const BImage* BCursor::image() const
{
	return member.image.ptr();
}

void BCursor::setPoint(const BPoint& point)
{
	member.point = point;
}
void BCursor::setPoint(int x, int y)
{
	member.point.set(x, y);
}
const BPoint& BCursor::point() const
{
	return member.point;
}

void BCursor::setSize(const BSize& size)
{
	member.size = size;
}
void BCursor::setSize(int width, int height)
{
	member.size.set(width, height);
}
const BSize& BCursor::size() const
{
	return member.size;
}

void BCursor::setGlobalPos(const BPoint& pos)
{
	setGlobalPos(pos.x(), pos.y());
}
void BCursor::setGlobalPos(int x, int y)
{
	
}
BPoint BCursor::globalPos()
{
	
	return BPoint();
}

void BCursor::show()
{
	
}
void BCursor::hide()
{

}

#endif

#ifdef _WINDOWS_SYSTEM_
#include <Windows.h>

BCursor::BCursor(CursorType type)
{
	member_allocate();
	member.type = type;
}
BCursor::~BCursor()
{
	member_release();
}

void BCursor::setType(CursorType type)
{
	member.type = type;
}
CursorType BCursor::type() const
{
	return member.type;
}

void BCursor::setImage(BImage* image)
{
	member.image = image;
}
BImage* BCursor::image()
{
	return member.image.ptr();
}
const BImage* BCursor::image() const
{
	return member.image.ptr();
}

void BCursor::setPoint(const BPoint& point)
{
	member.point = point;
}
void BCursor::setPoint(int x, int y)
{
	member.point.set(x, y);
}
const BPoint& BCursor::point() const
{
	return member.point;
}

void BCursor::setSize(const BSize& size)
{
	member.size = size;
}
void BCursor::setSize(int width, int height)
{
	member.size.set(width, height);
}
const BSize& BCursor::size() const
{
	return member.size;
}

void BCursor::setGlobalPos(const BPoint& pos)
{
	setGlobalPos(pos.x(), pos.y());
}
void BCursor::setGlobalPos(int x, int y)
{
	BOOL ret = ::SetCursorPos(x, y);
}
BPoint BCursor::globalPos()
{
	POINT point;
	BOOL ret = ::GetCursorPos(&point);
	return BPoint(point.x, point.y);
}

void BCursor::show()
{
	int count = -1;
	while(count < 0)
		count = ::ShowCursor(TRUE);
}
void BCursor::hide()
{
	int count = 0;
	while(count >= 0)
		count = ::ShowCursor(FALSE);
}


#endif
